<?php

require_once 'Zend/Application/Bootstrap/Bootstrap.php';
require_once 'Zend/Controller/Front.php';

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(array(
            'namespace' => 'Spalm_',
            'basePath'  => APPLICATION_PATH,
        ));

        return $autoloader;
    }

    protected function _initDoctype()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        //Zend_Layout::startMvc(APPLICATION_PATH . '/layouts/scripts');
        //$view = Zend_Layout::getMvcInstance()->getView();
        $view->doctype('XHTML1_STRICT');

    }

//    public function _initDojo(){
//        $view = $this->getResource('view');
//        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
//        $view->headTitle()->setSeparator(' - ');
//        $view->headTitle('Spalm.com');
//
//        Zend_Dojo::enableView($view);
//        $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
//        $viewRenderer->setView($view);
//        $view->dojo()
//                ->addStyleSheetModule('dijit.themes.tundra')
//                ->setDjConfigOption('usePlainJson', true)
//                ->disable();
//    }

    public function _initController() {
        if (defined('BOOTSTRAP')) {
            require_once 'Zend/Loader.php';
            Zend_Loader::registerAutoload();
        }

        //$front = Zend_Controller_Front::getInstance();
        //$front->setControllerDirectory(APPLICATION_PATH . '/controllers');
        //
        //
        //unset ($front);
        Zend_Controller_Front::run(APPLICATION_PATH . '/controllers');
    }

    public function _initLayout(){
        Zend_Layout::startMvc(APPLICATION_PATH . '/layouts');
    }
}


